<%@ page import="com.itcast.Student" %>
<%@ page import="java.util.*" %><%--
  Created by IntelliJ IDEA.
  User: 22657
  Date: 2020/7/21
  Time: 10:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>el表达式</title>
</head>
<body>
<% String str = "古力娜扎";
pageContext.setAttribute("string",str);
%>
基本数据类型String:${string}<br/>
<% String[] arr = {"hello", "world"};
    pageContext.setAttribute("arr", arr);
%>
    ${arr[0]}<br/>
    ${arr[1]}<br/>
<%--自定义对象--%>
<% Student s = new Student("迪丽热巴",18);
pageContext.setAttribute("stu",s);
%>
学生姓名:${stu.username}<br/>
学生年龄:${stu.age}<br/>
<%--map类型--%>
<% Map<String,Student> map = new HashMap<>();
map.put("beauty1",new Student("迪丽热巴",18));
map.put("beauty2",new Student("古力娜扎",19));
pageContext.setAttribute("map",map);
%>
map中学生对象:${map.beauty1}<br/>
map中学生的姓名:${map.beauty2.username}<br/>
<% ArrayList<String> array = new ArrayList<>();
Collections.addAll(array,"迪丽热巴","古力娜扎","宋祖儿","马尔扎哈");
pageContext.setAttribute("array",array);
%>
ArrayList集合第三个元素:${array[3]}
</body>
</html>
